package com.tedu.weibo.common.result;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor//全参构造器
@NoArgsConstructor//无参构造器
public class JsonResult {
    private Integer status;
    private String mag;
    private Object data;

    public JsonResult(StatusCode status) {
        this.status = status.getStautsCode();
        this.mag = status.getMessage();
    }

    public JsonResult(StatusCode status, Object data) {
        this(status);
        this.data = data;
    }

    public static JsonResult suceess(Object data){
        return new JsonResult(StatusCode.OPERATION_SUCCESS);
    }
    public static JsonResult suceess(){
//        return new JsonResult(StatusCode.OPERATION_SUCCESS);
        return suceess(null);
    }
}
